<template>
    <div v-if="isLoad">
        <listText :title="'合作企业'" :itemVal="infoSource.name"></listText>
        <listText :title="'联系方式'" :itemVal="infoSource.mobile"></listText>
        <listText :title="'通讯地址'" :itemVal="infoSource.province + infoSource.city + infoSource.area + infoSource.address"></listText>
        <listText :title="'所属行业'" :itemVal="infoSource.industry_name"></listText>
        <listText :title="'客户类型'" :itemVal="infoSource.cooperation_name"></listText>
        <listText :title="'业务员'" :itemVal="infoSource.salesman_text"></listText>
        <listText :title="'特殊备注'" :itemVal="infoSource.remark"></listText>
        <listText :title="'合作机会'" :itemVal="infoSource.cooperation"></listText>
        <div class="link-btn">
            <router-link v-if="button1" tag="div" to="/bxEditor?type=4">信息编辑</router-link>
            <router-link v-if="button2" tag="div" to="/rlAllocationPeople">分配负责人</router-link>
            <router-link v-if="button3" tag="div" to="/rlProdectConfig">产品配置</router-link>
            <router-link v-if="button4" tag="div" to="/rlConfigHistory">产品配置记录</router-link>
        </div>
    </div>
</template>

<script>
import listText from '@/components/listText.vue'

export default {
    name: "insurance",
    data() {
        return {
            infoSource: {},

            isLoad: false,
            button1: false,     // 信息编辑
            button2: false,     // 分配负责人
            button3: false,     // 产品配置
            button4: false,     // 产品配置记录

        };
    },
    components: {
        listText, listText
    },
    methods: {
        getInfo() {
            let params = {
                wx_member_id: localStorage.getItem('wx_member_id'),
                token: localStorage.getItem('token'),
                cate_id: 4,
            };
            this.$post("/api/member/read", params)
                .then(res => {
                    if (res.code == 1) {
                        this.$Toast.clear();
                        this.isLoad = true
                        this.infoSource = res.data
                    } else {
                        this.$Toast.clear();
                        this.$Toast(res.msg);
                    }
                })
                .catch(err => {
                });
        },
    },
    created() {
        this.$Toast.loading({
            duration: 0, // 持续展示 toast
            message: '加载中...',
            forbidClick: true
        });
        this.button1 = this.$queryMenu('Business/edit_info');       //客户信息编辑
        this.button2 = this.$queryMenu('Business/product_deal');    //产品配置
        this.button3 = this.$queryMenu('Business/leader');          //分配负责人
        this.button4 = this.$queryMenu('Business/product_log');     //产品配置记录

        this.getInfo();


    },
};
</script>

<style scoped lang="less">
/**
    * @Description: 业务-保险
    * @author Wangshu
    * @date 2020/1/3
    */
.insurance {
    width: 100vw;
}

.link-btn {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;

    div {
        width: 45vw;
        height: 34px;
        border-radius: 4px;
        background: #366cb3;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        margin: 4px;
        font-size: 12px;
    }

    div {
        width: 45vw;
        height: 40px;
        border-radius: 5px;
        background: #366cb3;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        margin: 5px;
        font-size: 15px;
    }

    .red-btn {
        background-image: linear-gradient(90deg, #f54a51 0%, #b62e34 100%);
    }
}

.info-line {
    border-bottom: 1px solid #eee;
    margin: 0 16px;
    padding: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;

    > div:nth-of-type(1) {
        width: 96px;
        color: #777777;
    }

    > div:nth-of-type(2) {
        flex: 1;
        color: #333;
    }
}

.border-last:last-child {
    border: none;
}
</style>